import {
  getBaseCategoryList,
  getMockBannerList,
  getMockFloorList
} from '@/api/home'

const state = {
  cateList: [],
  bannerList: [],
  floorList: []
}
const mutations = {
  SET_CATE_LIST (state, payload) {
    state.cateList = payload
  },
  SET_BANNER_LIST (state, payload) {
    state.bannerList = payload
  },
  SET_FOOTER_LIST (state, payload) {
    state.floorList = payload
  }
}
const actions = {
  async getCateList (store) {
    const res = await getBaseCategoryList()
    // console.log('res:', res)
    store.commit('SET_CATE_LIST', res.data)
  },
  async getBannerList ({ commit }) {
    const res = await getMockBannerList()
    commit('SET_BANNER_LIST', res.data)
  },
  async getFloorList ({ commit }) {
    const res = await getMockFloorList()
    commit('SET_FOOTER_LIST', res.data)
  }
}
const getters = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
